package com.ruoyi.yyq.service.impl;

import java.util.List;

import com.ruoyi.yyq.domain.CarVerificationRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yyq.mapper.CarEvaluationMapper;
import com.ruoyi.yyq.domain.CarEvaluation;
import com.ruoyi.yyq.service.ICarEvaluationService;

/**
 * 评价Service业务层处理
 * 
 * @author 尹永青
 * @date 2025-05-10
 */
@Service
public class CarEvaluationServiceImpl implements ICarEvaluationService 
{
    @Autowired
    private CarEvaluationMapper carEvaluationMapper;

    /**
     * 查询评价
     * 
     * @param id 评价主键
     * @return 评价
     */
    @Override
    public CarEvaluation selectCarEvaluationById(Long id)
    {
        return carEvaluationMapper.selectCarEvaluationById(id);
    }

    /**
     * 查询评价列表
     * 
     * @param carEvaluation 评价
     * @return 评价
     */
    @Override
    public List<CarEvaluation> selectCarEvaluationList(CarEvaluation carEvaluation)
    {
        return carEvaluationMapper.selectCarEvaluationList(carEvaluation);
    }

    /**
     * 新增评价
     * 
     * @param carEvaluation 评价
     * @return 结果
     */
    @Override
    public int insertCarEvaluation(CarEvaluation carEvaluation)
    {
        return carEvaluationMapper.insertCarEvaluation(carEvaluation);
    }

    /**
     * 修改评价
     * 
     * @param carEvaluation 评价
     * @return 结果
     */
    @Override
    public int updateCarEvaluation(CarEvaluation carEvaluation)
    {
        return carEvaluationMapper.updateCarEvaluation(carEvaluation);
    }

    /**
     * 批量删除评价
     * 
     * @param ids 需要删除的评价主键
     * @return 结果
     */
    @Override
    public int deleteCarEvaluationByIds(Long[] ids)
    {
        //标记操作成功次数
        int success = 0;
        // 假删除
        for (Long id : ids) {
            CarEvaluation carEvaluation = new CarEvaluation();
            carEvaluation.setId(id);
            carEvaluation.setDeleted(1L);
            carEvaluationMapper.updateCarEvaluation(carEvaluation);
            success++;
        }
        return success;
    }

    /**
     * 删除评价信息
     * 
     * @param id 评价主键
     * @return 结果
     */
    @Override
    public int deleteCarEvaluationById(Long id)
    {
        return carEvaluationMapper.deleteCarEvaluationById(id);
    }
}
